<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <common-head></common-head>
  </div>
  <script src="./vue.js"></script>
  <script>
    const Logo = {
      // 子组件中 定义 待接收的 属性列表
      props: {
        a: Number,
        b: [Number, String],
        c: {
          type: String,
          required: true
        },
        d: {
          type: String,
          default: '默认志'
        },
        e: {
          type: Array,
          default: () => [1,2,3,4]
        }
      },
      template:`
        <h3>
          我是子组件 
          <hr/>
          {{a}} 
          {{b}} 
          {{c}} 
          {{d}} 
          <input v-model="c"/>
          <button v-for="item in e" :key="item">
            {{item}}
          </button>
        </h3>
      `,
      mounted(){
        console.log(this);
      }
    }
    const CommonHead = {
      /* 
      定义组件的 结构 
      */
      template:`
        <div>
          <h1>我是父组件</h1>
          <logo :a="10" :b="10" c="aaaa"></logo>
        </div>
      `,
      data(){
        return {
          msg: '我是父组件动态数据'
        }
      },
      components: {
        Logo: Logo
      }
    }
    Vue.component('CommonHead', CommonHead)
    const vm = new Vue({
      el: '#app'
    })
  </script>
</body>
</html>